import request from '@/utils/request'

export default {
  queryUpload(queryParam, pageParam) {
    return request({
      url: '/upload/query',
      method: 'post',
      data: {
        ...queryParam,
        ...pageParam
      }
    })
  },
  delUpload(param) {
    return request({
      url: '/upload/del',
      method: 'post',
      data: param
    })
  },
  uploadFile(file, name, fileName) {
    const formdata = new FormData()
    formdata.append('file', file)
    formdata.append('name', name)
    formdata.append('fileName', fileName)
    return request({
      url: '/upload/add',
      method: 'post',
      data: formdata,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      timeout: 0
    })
  },

  imageList(pageParam) {
    return request({
      url: '/upload/imageList',
      method: 'post',
      data: pageParam
    })
  }
}
